package com.xlh.server.protocol.support.json;

import android.os.Handler;

import com.xlh.Utils.GsonManager;
import com.xlh.Utils.MudProtocol;
import com.xlh.bean.CenterText;
import com.xlh.bean.ProtocolObject.Base;
import com.xlh.bean.ProtocolObject.Window;
import com.xlh.bean.TitleBean;
import com.xlh.interf.IActivity;
import com.xlh.interf.ITakeMessage;
import com.xlh.thread.MessageBagerTask;

/**
 * Created by Administrator on 2018/7/2.
 */

public class RemoveRoomObejctServer implements ITakeMessage {

    private IActivity atv;
    private String hasType = "removeRoomObejct";
    private Base protccoObj;
    public RemoveRoomObejctServer(IActivity atv){
        this.atv = atv;


    }

    @Override
    public void takeMessage(String t,String s){

        if(!t.equals(this.hasType)) return;

        protccoObj =  GsonManager.gsmgr.jsonToAnyObject(s, Base.class);

        if(protccoObj==null || protccoObj.getText().equals("")) return;


        TitleBean npcBean = new TitleBean();
        for (int i = 0; i < this.atv.getActivity().getmTitleData().size(); i++) {
            npcBean = this.atv.getActivity().getmTitleData().get(i);
            if (npcBean==null) continue;
            if (npcBean.getmAction().equals(protccoObj.getText())) {
                this.atv.getActivity().getmTitleData().remove(npcBean);
            }
        }

        this.atv.getActivity().mTitleAdapter.setData(this.atv.getActivity().getmTitleData());
        return;



    }

    @Override
    public boolean takeMessage(String s) {
        return false;
    }

    @Override
    public void init() {

    }

    @Override
    public void atViewLoadAfterInit() {

    }






}
